<template>
    <div>
            <h1>注册页面</h1>
            <van-field type="text" label="请输入注册名" placeholder="" v-model="username"/>
            <van-field type="password" label="请输入注册密码" placeholder="" v-model="password"/>
            <van-button type="primary" @click="add_user">注册</van-button>


            <br>
            <br>
            <br>
            <br>


    </div>
</template>

<script>
export default {
   data () {
      return {
            username:'',
            password:''
      };
   },

    methods: {
            //注册用户
            add_user:function(){
                this.axios.get(this.localhost+'test_login/',{params:{
                    username:this.username,
                    password:this.password
                }}).then(res=>{
                    console.log(res);
                    if(res.data.code == 200){
                        this.$toast.success('注册成功')
                        this.username = ''
                        this.password = ''
                        this.$router.push('/test_denglu/')
                    }else{
                        this.$toast.fail(res.data.meg)
                    }
                })
            }
       },

    computed: {

       },

    created () {

       },

    mounted() {

       },

    components: {

       }
}
</script>
<style lang='css' scoped>

</style>